<?php

require_once( dirname(__FILE__) . '/cache.php');

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=> 'YourStyle.com', //'-------------------'
    'defaultController' => 'site',
	'language' => 'ru',

	// preloading 'log' component
	'preload'=>array(
		'gettext',
//		'log'
	),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
		'application.extensions.*',
		'application.helpers.*',
        'ext.YiiMailer.YiiMailer',
	),

	'modules'=>array(
        'users', 'goods', 'pages',
		// uncomment the following to enable the Gii tool
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'nhfnfnf',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1', '192.168.0.107'),
		),
	),

	// application components
	'components'=>array(
		'user'=>array('class' => 'WebUser', 'allowAutoLogin'=>true,),
//		'request'=>array('class'=>'application.components.DLanguageHttpRequest',),
		'errorHandler'=>array('errorAction'=>'site/error',),

		// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			//'class' => 'application.components.UrlManager',
			'class' => 'CUrlManager',
			'urlFormat'=>'path',
            'showScriptName' => false,
            'caseSensitive' => false,
            //'defaultParams' => true,
			'rules'=>array(
				'gii'=>'gii',
				'gii/<controller:\w+>'=>'gii/<controller>',
				'gii/<controller:\w+>/<action:\w+>'=>'gii/<controller>/<action>',

				'/'=>'site/index',
				'/login'=>'site/login',
//
//				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
//				'<controller:\w+>/<action:^\w+>/<id:\d+>'=>'<controller>/<action>',
//				'<controller:\w+>/<action:^\w+>'=>'<controller>/<action>',

//				'<module:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>/*'=>'<module>/<controller>/<action>',

                '/cart/add/<id:\d+>' => 'goods/cart/add',
                '/cart/remove/<id:\d+>' => 'goods/cart/remove',
                '/cart/success' => 'goods/cart/success',
                '/cart/' => 'goods/cart/list',

                '/search'=>'search/search',
                '/usefully_<id:[\w\-_]+>'=>'pages/default/index',

                '/<category:[\w\-]+[a-z]>_<id:[\w\-]+>' => 'goods/default/view',
                '/<category_id:[\w\-]+[a-z]>' => 'goods/default/index',

                '/admin/<module:(category|vendor|gallery)>/<action:\w+>/*'=>'<module>/<action>',
                '/admin/<module:\w+>/<controller:(order)>/<action:\w+>/*'=>'<module>/<controller>/<action>',
                '/admin/<module:\w+>/<action:\w+>/*'=>'<module>/admin/<action>',
			),
		),

		'db'=>array(
            'class' => 'CDbConnection',
            'connectionString' => 'mysql:host=localhost;dbname=sd',
            'charset' => 'utf8',
            'username' => 'dev',
            'password' => '6tmwmyhZzw5E6ZR9',
            'emulatePrepare' => true,
            'tablePrefix' => '',
//            'enableParamLogging' => true,
			'schemaCachingDuration' => 1000,
		),

		'session' => array('class' => 'CCacheHttpSession',),
//		'session' => array(
//			'class' => 'CDbHttpSession',
//			'connectionID' => 'db',
//			'sessionTableName' => 'session',
//			'autoCreateSessionTable' => false,
//		),

        'cache' => array(
            'class' => 'CMemCache',
            'servers' => array(
                array('host' => 'localhost', 'port' => 11211, 'weight' => 60),
            ),
        ),

        'authManager'=>array(
            'class'=>'PhpAuthManager',
            'defaultRoles' => array('guest'),
        ),

//		'errorHandler'=>array(
//			// use 'site/error' action to display errors
//			'errorAction'=>'site/error',
//		),

//		'log'=>array(
//			'class'=>'CLogRouter',
//			'routes'=>array(
////				array(
////					'class'=>'CFileLogRoute',
////					'levels'=>'error, warning',
////				),
//				// uncomment the following to show log messages on web pages
//
//                array(
//                    'class'=>'CWebLogRoute',
//                    'levels'=>'trace, error',
//                    'categories'=>'system.*',
//                    'showInFireBug'=>true,
//                ),
//
//            ),
//        ),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
        'host' => '6pm.dyndns.org',
        'phone' => '(099)316-12-01',

        'listPerPage' => 20,
		// this is used in contact page
		'adminEmail'=>'mebatua@gmail.com',

        'photos' => array(
            'goods' => array(
                '-' => '4800/4800',
                'list' => '200/200',
                'preview' => '60/60',
            ),

            'vendor' => array(
	            '-' => '620/620',
	            'list' => '295/295',
            ),

            'pages' => array(
	            '-' => '1920/1920',
	            'list' => '200/200',
            ),
        ),


	    'social' => array(
		    'SocialFacebook' => array(
			    'appId' => '239929256051534',
			    'secret' => '68fdc83c2bdae8f50fce7d2da4f819df',
		    )
	    )

	),
);